(function(angular) {
	'use strict';
	angular.module('fs.waf').controller('cda.popup.viewResponseController', viewResponseController)
	/*.filter("responseStatus", [ '$filter', '$locale', 'viewResponseController', function($filter, $locale, viewResponseController) {
		return function(responseStatus, pattern) {
			return $filter('translate')(viewResponseController.responseStatusFilter(responseStatus, pattern));
		};
	} ])*/;
	viewResponseController.$inject = [ '$scope', '$q', '$uibModalInstance', 'Constants', 'ajaxServiceFactory', 'dialogsModule', 'gridService', 'modalService', 'layoutConfig', 'validatorConfig', 'authService' ];
	function viewResponseController($scope, $q, $uibModalInstance, Constants, ajaxServiceFactory, dialogsModule, gridService, modalService, layoutConfig, validatorConfig, authService) {
		var ctrl = this;
		ctrl.dialogsModule = dialogsModule;
		ctrl.layoutConfig = layoutConfig;
		ctrl.validatorConfig = validatorConfig;
		ctrl.extRequest = {};
		
		ctrl.close = function() {
			if (!dialogsModule.btnCallback || !dialogsModule.btnCallback['close'] || dialogsModule.btnCallback['close']() !== false) {
				$uibModalInstance.dismiss();
			}
		};
		
		/*function responseStatusFilter(optionValue) {
			var options =[{label:"Ok",value:"A"},{label:"Rejected",value:"R"},{label:"Error",value:"E"}];
			var optionLabel = '';
			if(options) {
				angular.forEach(options, function(obj, index) {
					if(optionValue == obj.value) {
						optionLabel = obj.label;
					}
				});
			}
			return optionLabel;
		}*/
		
		ctrl.init = function() {
			authService.view(ctrl.dialogsModule.params).then(function(response) {
				if(response.data){
					ctrl.extRequest.reqId = response.data[0].reqId;
					ctrl.extResponseList = response.data;
				}
			});
		};
	}
})(angular);
